<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGoodOrderDetailsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('good_order_details', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('oid')->default('0')->comment('订单关联Id');
            $table->integer('good_id')->default('0')->comment('商品ID');
            $table->integer('good_number')->default('0')->comment('商品数量');
            $table->decimal('good_price')->default('0.00')->comment('商品单价');
            $table->string('good_name')->default('')->comment('商品名称');
            $table->string('good_image')->nullable()->comment('商品图片');
            $table->decimal('total_price')->default('0.00')->comment('订单总价');
            $table->float('shop_rate')->default('0.00')->comment('门店分成比例');
            $table->decimal('shop_money')->default('0.00')->comment('门店分成金额');
            $table->float('agent_city_rate')->default('0.00')->comment('市代理商分成比例(有区代理)');
            $table->decimal('agent_city_money')->default('0.00')->comment('市代理商分成(有区代理)');
            $table->float('agent_district_rate')->default('0.00')->comment('区代理商分成比例');
            $table->decimal('agent_district_money')->default('0.00')->comment('区代理商分成');
            $table->float('agent_city_rate1')->default('0.00')->comment('市代理商分成比例(无区代理)');
            $table->decimal('agent_city_money1')->default('0.00')->comment('市代理商分成(无区代理)');
            $table->float('user_rate')->default('0.00')->comment('上级用户分销比例');
            $table->decimal('user_money')->default('0.00')->comment('上级用户分销分成');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('good_order_details');
    }
}
